 |
|
 |
Subject: NotesDXLExporter error 4601 |
 |
 |
 |
Product Area: Notes 8 Client |
 |
Technical Area: Error Message |
 |
Platform: Windows XP client |
 |
Release: 8.0.1 |
 |
Reproducible: Always |
 |
 |
 |
 |
To all:
In the Notes 8 Client, I am using a Shared Action in the Message (Memo) form to save, send, and close an e-mail. As part of the Action, I export the saved e-mail to DXL to be processed by another program. The e-mail is "new" and is open in "edit" mode when the user clicks on the Shared Action button. At the conclusion of the Shared Action, the e-mail closes and the user sees whatever View he/she had been in when he/she clicked the "New Message" button.
The code works flawlessly for e-mails without attachments, and a DXL version of the saved and sent e-mail is saved to the user's desktop. However, if there is an attachment in the e-mail, no matter the size or the file type the Action crashes with the following error information (the NoteID, of course, varies):
NOTES ERROR INFORMATION:
Error Number: 4601
Error Message: DXL exporter operation failed
DXLExporter ERROR LOG:
<?xml version='1.0'?>
<DXLExporterLog>
<error id='7112'>Error occurred during processing of note ID 0x12C2</error>
<error id='551'>Invalid or nonexistent document</error>
<error>DXL exporter operation failed</error>
</DXLExporterlog>
The code works when run against the same document once it has been closed and is in a View.
I have exhaustively tested all posted workarounds and they do not work.
Assuming it is some kind of caching problem, I have also tried:
-- Programmatically clearing all of the documents in "Cache.NDK" on the user's computer immediately prior to getting the NotesDocument object to be exported.
-- Storing the UniversalID in a variable global to the Message (Memo) form and using it in the global Terminate event of the form to get the NotesDocument object and export it in the final event of the Message (Memo) form's life cycle.
In every case where it is an attachment, the Action crashes on the "Export" method of the NotesDXLExporter object.
I have posted my code, lengthy as it is, at the bottom of this post. I appreciate any insights into why this is occurring and how to correct it.
Sincerely,
Joseph Davoli
Form Action:
------------
Sub Click(Source As Button)
'Set the error handler.
On Error Goto ErrorHandler
'Declare a helper variable.
Dim strHelper As String
Dim strURL As String
'Notes back-end declarations.
Dim MySession As New NotesSession
Dim MyDatabase As NotesDatabase
Dim MyCollection As NotesDocumentCollection
Dim MyDocument As NotesDocument
'Notes front-end declarations.
Dim MyUIWorkspace As New NotesUIWorkspace
Dim MyUIDocument As NotesUIDocument
'Notes front-end assignment.
Set MyUIDocument = MyUIWorkspace.CurrentDocument
'Save this document.
'NOTE: This will initiate the sending of the document.
Call MyUIDocument.Save
'Get the back-end document.
Set MyDocument = MyUIDocument.Document
'Notes back-end assignment.
Set MyDatabase = MySession.CurrentDatabase
'Create an empty NotesDocumentCollection.
Set MyCollection = MyDatabase.GetProfileDocCollection( "MeaninglessParameter" )
'Add the newly-saved document to our empty NotesDocumentCollection.
Call MyCollection.AddDocument( MyDocument )
'Call a subroutine in the XMLToDocumentum Script Library.
Call ExportDocumentsToXML( MyCollection, "http://SomeURL" )
'Close this document.
Call MyUIDocument.Close( False )
Exit Sub
ErrorHandler:
Msgbox "This button generated the following error:" & Chr( 13 ) & Chr( 10 ) & Chr( 13 ) & Chr( 10 ) & "Error Number: " & Err() & ", Error Message: " & Error(), MB_OK + MB_ICONSTOP, "ATTENTION!"
End Select
Exit Sub
End Sub
Script Library subroutine:
--------------------------
Sub ExportDocumentsToXML (subCollection As NotesDocumentCollection, strURL As String )
'Set the error handler.
On Error Goto ErrorHandler
'Declare some helper variables.
Dim strHelper As String
Dim I As Integer
Dim strDocumentXML As String
Dim strDocumentXMLSummary As String
Dim strSummaryGUID As String
Dim strPath As String
Dim strFilePathAndName As String
Dim blnProceedWithExport As Boolean
Dim lngDocumentCounter As Long
'Back-end Notes declarations.
Dim MySession As New NotesSession
Dim MyDatabase As NotesDatabase
Dim MyView As NotesView
Dim MyDocument As NotesDocument
Dim MyStrawDocument As NotesDocument
Dim MyItem As NotesItem
Dim MyDXLExporter As NotesDXLExporter
Dim MyStream As NotesStream
'Back-end Notes assignments.
Set MyStream = MySession.CreateStream
Set MyDatabase = MySession.CurrentDatabase
'Initialize our array element counter.
I = 0
'Get the location of the user's "Application Data" directory. Add to it the subdirectory name "\SomeDirectory".
strPath = Environ("APPDATA") & "\SomeDirectory"
'Check to see if the "SomeDirectory" subdirectory exists.
If Dir$( strPath, ATTR_DIRECTORY ) <> "" Then
'The directory exists. Delete any subdirectories and files within those subdirectories.
Call DeleteSubdirectoriesAndFiles ( strPath )
Else
'The directory does not exist. Create it.
Mkdir ( strPath )
End If 'End checking to see if the "SomeDirectory" subdirectory exists.
'Create a new NotesDocument solely for the purpose of getting its DocumentID. We are using this to create a GUID.
'NOTE: The DocumentID assigned when new is discarded when the document is saved. We will not be saving this document,
' so this should guarantee a unique ID each time.
Set MyDocument = MyDatabase.CreateDocument
strSummaryGUID = MyDocument.UniversalID
'Now, create a subdirectory under "SomeDirectory" with the name of our GUID.
Mkdir ( strPath & "\" & strSummaryGUID )
'Initialize the Summary version of all of the DXL documents created.
strDocumentXMLSummary = "<?xml version='1.0' ?>"
strDocumentXMLSummary = strDocumentXMLSummary & "<documents xmlns='http://www.lotus.com/dxl' version='1.0' groupid='" & strSummaryGUID & "'>"
'Initialize our Document-counting variables.
lngDocumentCounter = 0
'Get the first Document in DocumentCollection.
Set MyDocument = subCollection.GetFirstDocument
'Iterate through the Notes Document Collection, exporting each Document in XML format and flagging the document
'as having been exported.
While Not MyDocument Is Nothing
'Concatenate the path information with the UniversalID of the Document to be exported.
strFilePathAndName = strPath & "\" & strSummaryGUID & "\" & MyDocument.UniversalID & ".xml"
'Check to see if this file already exists in the subdirectory.
'NOTE: The constant "ATTR_NORMAL" is available because we use the following line in
' the (Declarations) section of this Script Library:
' %INCLUDE "lsconst.lss"
If Dir$( strFilePathAndName, ATTR_NORMAL ) <> "" Then
'Delete any previous instance of the XML file.
Kill strFilePathAndName
End If 'End checking to see if the file already exists in the subdirectory.
'Use the "Open" method of the NotesStream object to try to create a new, empty file.
If MyStream.Open( strPath & "\" & strSummaryGUID & "\" & MyDocument.UniversalID & ".xml" ) Then
'Create an instance of our DXLExporter object passing to it this Document as its sole parameter.
Set MyDXLExporter = MySession.CreateDXLExporter( MyDocument )
'Specify that the DXLExporter should convert any bitmaps pasted into a Rich Text Field
'into GIF's.
MyDXLExporter.ConvertNotesBitmapsToGIF = True
'Specify that the DXLExporter should not output a Document Type Definition (DTD).
MyDXLExporter.OutputDOCTYPE = False
'Export the NotesDocument to a string variable in DXL format.
'NOTE: Limits on string data representation in LotusScript - Length of a string value: 2GB.
strDocumentXML = MyDXLExporter.Export
 
Feedback number WEBB7PHUY4 created by ~August Cisniplopakol on 02/22/2009


NotesDXLExporter error 4601 (~August Cisnipl... 22.Feb.09)
. . If it works with a NotesDocument so... (~Bill Frokimari... 28.Feb.09) |
|  |
|